package com.bingfor.easycablelink.my.viewModel;

import android.content.DialogInterface;

import com.bingfor.easycablelink.base.BaseActivity;
import com.bingfor.easycablelink.my.ContactUsActivity;
import com.bingfor.easycablelink.my.FeedbackActivity;
import com.bingfor.easycablelink.my.MessageListActivity;
import com.bingfor.easycablelink.my.PersonCenterActivity;
import com.bingfor.easycablelink.utils.DialogHelp;
import com.bingfor.easycablelink.utils.ShareUtils;
import com.bingfor.easycablelink.utils.ToastUtil;
import com.bingfor.easycablelink.widgets.ViewModel;
import com.umeng.socialize.UMShareListener;
import com.umeng.socialize.bean.SHARE_MEDIA;

/**
 * Created by LY on 2017/5/17.
 */

public class MyPageViewModel implements ViewModel {

    public BaseActivity mContent;

    public MyPageViewModel(BaseActivity mContent) {
        this.mContent = mContent;
    }

    public void toNext(int id){
        switch (id){
            case -1:
                mContent.moveToNextPage(MessageListActivity.class);
                break;
            case 0:
                mContent.moveToNextPage(PersonCenterActivity.class);
                break;
            case 1:
                mContent.moveToNextPage(FeedbackActivity.class);
                break;
            case 2:
                mContent.moveToNextPage(ContactUsActivity.class);
                break;
            case 3:
                DialogHelp.getMessageDialog(mContent, "请确认清除缓存？", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        mContent.showSnakeBar("清除成功！");
                    }
                }).show();
                break;
            case 4:
                mContent.showSnakeBar("当前为最新版本.");
                break;
        }
    }

    public void toShare(int type){
        switch (type){
            case 0:
                ShareUtils.QqShare(mContent,"http://www.baidu.com",listener );
                break;
            case 1:
                ShareUtils.WeixinShare(mContent,"http://www.baidu.com",listener );
                break;
            case 2:
                ShareUtils.WeixinCircleShare(mContent,"http://www.baidu.com",listener );
                break;
            case 3:
                ShareUtils.QqZoneShare(mContent,"http://www.baidu.com",listener );
                break;
        }

    }

    UMShareListener listener = new UMShareListener() {
        @Override
        public void onStart(SHARE_MEDIA share_media) {

        }

        @Override
        public void onResult(SHARE_MEDIA share_media) {

        }

        @Override
        public void onError(SHARE_MEDIA share_media, Throwable throwable) {

        }

        @Override
        public void onCancel(SHARE_MEDIA share_media) {

        }
    };
}
